package com.beiming.libra.service.impl;

import com.beiming.libra.common.page.Page;
import com.beiming.libra.common.page.PageResult;
import com.beiming.libra.dao.ArbitrationCaseLogMapper;
import com.beiming.libra.domain.ArbitrationCaseLog;
import com.beiming.libra.domain.dto.requestdto.CommonIdPageRequestDTO;
import com.beiming.libra.service.ArbitrationCaseLogService;
import com.beiming.libra.service.base.BaseServiceImpl;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 案件流水日志服务层
 *
 * @author zhangqi
 */
@Service
@Slf4j
public class ArbitrationCaseLogServiceImpl extends BaseServiceImpl<ArbitrationCaseLog> implements
    ArbitrationCaseLogService<ArbitrationCaseLog> {

  @Resource
  private ArbitrationCaseLogMapper arbitrationCaseLogMapper;

  /**
   * 案件日志查询列表
   */
  @Override
  public PageResult<ArbitrationCaseLog> getArbitrationCaseLogList(
      CommonIdPageRequestDTO commonIdPageRequestDTO) {
    PageResult<ArbitrationCaseLog> list = new PageResult<>();
    Page page = new Page();
    if (commonIdPageRequestDTO.getPageNo() != 0) {
      page.setPageNo(commonIdPageRequestDTO.getPageNo());
      page.setPageSize(commonIdPageRequestDTO.getPageSize());
    }
    page.setTotalRecords(arbitrationCaseLogMapper.pageCount(commonIdPageRequestDTO.getCaseId()));
    list.setPage(page);
    list.setList(arbitrationCaseLogMapper.getArbitrationCaseLogList(commonIdPageRequestDTO));
    log.info("案件日志列表《getArbitrationCaseLogList》总条数=" + list.getList().size());
    return list;
  }
}
